﻿<h2 id="url"> @ViewBag.url</h2>
<button id="btn">复制链接</button>

<div style="width:400px;margin:0 auto">
    <img src="@ViewBag.url" width: 100%; height: auto; />
</div>





<script>
    $('#btn').click(function () {
        const oInput = document.createElement('input');
        oInput.value = $('#url').text();
        document.body.appendChild(oInput);
        oInput.select();
        document.execCommand('copy');
        oInput.className = 'oInput';
        document.getElementsByClassName("oInput")[0].remove();
        alert("复制成功");
    });

</script>

